CC = gcc
CFLAGS = -Wall -c
LD = gcc
LDFLAGS = -Wall
AS = nasm
ASFLAGS = -t -f coff 
OBJECTS = video-graphics.o sprite.o game_graphics.o main.o chartable.o freefalling.o rtc.o ints.o queue.o GQueue.o  timer.o music_interrupt.o teclado_interrupt.o  kbc.o music.o pontuacao.o


all: freefalling.exe


chartable.o: chartable.h
	$(LD) $(CFLAGS) chartable.c
	
video-graphics.o: video-graphics.h chartable.h
	$(CC) $(CFLAGS) video-graphics.c
	
sprite.o : sprite.h
	$(CC) $(CFLAGS) sprite.c

game_graphics.o: game_graphics.h
	$(CC) $(CFLAGS) game_graphics.c

freefalling.o: freefalling.h
	$(CC) $(CFLAGS) freefalling.c
	
music.o: music.h 
	$(CC) $(CFLAGS) music.c

kbc.o: kbc.c teclado_interrupt.asm music_interrupt.asm ints.h music.c
	$(LD) $(CFLAGS) kbc.c
	
ints.o: ints.h
	$(CC) $(CFLAGS) ints.c	
	
queue.o: queue.h 
	$(CC) $(CFLAGS) queue.c

GQueue.o: GQueue.h 
	$(CC) $(CFLAGS) GQueue.c
	
rtc.o: rtc.h
	$(CC) $(CFLAGS) rtc.c
	
timer.o: timer.h
	$(CC) $(CFLAGS) timer.c
	
pontuacao.o: pontuacao.h
	$(CC) $(CFLAGS) pontuacao.c
	
	
teclado_interrupt.o: teclado_interrupt.asm
	nasm -t -f coff teclado_interrupt.asm -o teclado_interrupt.o
	
music_interrupt.o: music_interrupt.asm
	nasm -t -f coff music_interrupt.asm -o music_interrupt.o

main.o:	video-graphics.o chartable.o game_graphics.o main.c sprite.o freefalling.o rtc.o ints.o queue.o GQueue.o timer.o music_interrupt.o teclado_interrupt.o kbc.o music.o pontuacao.o
	$(LD) $(CFLAGS) main.c
	


freefalling.exe: main.o 
	$(LD) $(LDFLAGS) $(OBJECTS) -o freefalling.exe


clean:
	-rm $(OBJECTS)
	-rm freefalling.exe





